package smartcrud.spring.models.cms;

import java.io.Serializable;
import java.util.Date;
/**
 * 
 * 
 */
public class Attachment implements Serializable{
	/**
	 * 当文件没有附件/图片时，主题主图下拉框中显示一项 "None"
	 */
	private final static Attachment nullAttachment = new Attachment();
	static{
		nullAttachment.setOriginalName("None");
		nullAttachment.setUrl("");
	}
	
	private Integer id;//
	private String fileType;//
	private String originalName;
	private String url;//
	private Integer size;//
	private Integer postId;//
	private Integer downloadCount;//
	private Date createDate;//
	
	public static Attachment nullAttachment(){
		return nullAttachment;
	}
	
	public Attachment(){}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return this.id;
	}
	public void setFileType(String fileType) {
		this.fileType = fileType;
	}
	public String getFileType() {
		return this.fileType;
	}
	
	public String getOriginalName() {
		return originalName;
	}
	public void setOriginalName(String originalName) {
		this.originalName = originalName;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getUrl() {
		return this.url;
	}
	public void setSize(Integer size) {
		this.size = size;
	}
	public Integer getSize() {
		return this.size;
	}
	public void setPostId(Integer postId) {
		this.postId = postId;
	}
	public Integer getPostId() {
		return this.postId;
	}
	public void setDownloadCount(Integer downloadCount) {
		this.downloadCount = downloadCount;
	}
	public Integer getDownloadCount() {
		return this.downloadCount;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Date getCreateDate() {
		return this.createDate;
	}
    @Override
    public int hashCode() {
        return new Long(id).hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (! (obj instanceof Attachment)) {
            return false;
        }
        return this.url.equals(((Attachment)obj).getUrl());
    }

}